package band.wukong.practice.springcloud.quickstart.qk01.client;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wukong(wukonggg@139.com)
 */
@EnableEurekaClient
@RestController
@SpringBootApplication
public class Qk01EurekaClientApplication {

    /*
        @EnableEurekaClient vs @EnableDiscoveryClient
        1. @EnableEurekaClient注解是基于spring-cloud-netflix依赖，只能为eureka作用；
        2. @EnableDiscoveryClient注解是基于spring-cloud-commons依赖，并且在classpath中实现；

        如果你的classpath中添加了eureka，则它们的作用是一样的。
     */

    @Value("${server.port}")
    private String port;

    @RequestMapping("/hi")
    public String home(@RequestParam String name) {
        return "Hi " + name + ", I am from port:" + port;
    }

    public static void main(String[] args) {
        SpringApplication.run(Qk01EurekaClientApplication.class, args);
    }

}
